package usercore.account.dao;

import java.util.List;
import java.util.Map;

public interface UserDao {

	public long generateUserId();

	public <T> List<T> listByFields(Map<String, Object> fields, Class<T> clazz);

	public <T> List<T> listByFields(Map<String, Object> fields, Class<T> clazz, boolean realTime);

	public <T> List<T> listByFields(Map<String, Object> fields, Class<T> clazz, boolean realTime,
			int rowIndex, int rowSize);

	public <T> List<T> listByFields(Map<String, Object> fields, Class<T> clazz, boolean realTime,
			int rowIndex, int rowSize, boolean random);

	public <T> List<T> listByField(String field, Object value, Class<T> clazz);

	public <T> List<T> listByField(String field, Object value, Class<T> clazz, boolean realTime);

	public <T> List<T> listByField(String field, Object value, Class<T> clazz, boolean realTime,
			int rowIndex, int rowSize);

	public <T> List<T> listByField(String field, Object value, Class<T> clazz, boolean realTime,
			int rowIndex, int rowSize, boolean random);

	public <T> List<T> listByFieldLike(String field, Object value, Class<T> clazz);

	public <T> List<T> listByFieldLike(String field, Object value, Class<T> clazz, boolean realTime);

	public <T> List<T> listByFieldLike(String field, Object value, Class<T> clazz,
			boolean realTime, int rowIndex, int rowSize);

	public <T> List<T> listByFieldRandom(String field, Object value, Class<T> clazz, int rowSize);

	public <T> List<T> listByFieldRandom(String field, Object value, Class<T> clazz,
			boolean realTime, int rowSize);

	public <T> T selectByFields(Map<String, Object> fields, Class<T> clazz);

	public <T> T selectByFields(Map<String, Object> fields, Class<T> clazz, boolean realTime);

	public <T> T selectByField(String field, Object value, Class<T> clazz);

	public <T> T selectByField(String field, Object value, Class<T> clazz, boolean realTime);

	public <T> T selectByFieldRandom(String field, Object value, Class<T> clazz);

	public <T> T select(long id, Class<T> clazz, boolean realTime);

	public <T> int insert(T t);

	public <T> long insertFetchId(T t);

	public <T> int replace(T t);

	public <T> int update(T t);

	public <T> int updateFields(Map<String, Object> fields, Map<String, Object> conditions,
			Class<T> clazz);

	public <T> int deleteByFields(Map<String, Object> fields, Class<T> clazz);

	public <T> int deleteByFields(Map<String, Object> fields, Class<T> clazz, int rowSize);

	public <T> int deleteByField(String field, String value, Class<T> clazz);

	public <T> int deleteByField(String field, String value, Class<T> clazz, int rowSize);

	public <T> int countByFields(Map<String, Object> fields, Class<T> clazz);

	public <T> int countByFields(Map<String, Object> fields, Class<T> clazz, boolean realTime);

	public <T> int countByField(String field, String value, Class<T> clazz);

	public <T> int countByField(String field, String value, Class<T> clazz, boolean realTime);

	public <T> boolean exist(Map<String, Object> fields, Class<T> clazz);

	public <T> boolean exist(Map<String, Object> fields, Class<T> clazz, boolean realTime);

	public <T> boolean exist(String field, Object value, Class<T> clazz);

	public <T> boolean exist(String field, Object value, Class<T> clazz, boolean realTime);

	public void insertLoginLog(long userId, int platform, int channelId, String ip, String realIp);

	public int countUsers();

}
